import {
    VUE_APP_API_URL
} from "../config/index.js"
import request from "../utils/request.js";

export function getDropDownList(url, page) {
    return request.get("appDropDown/" + url, {
        page
    }, {
        noAuth: true
    })
}

export function getstorehouseList(page,size) {
    return request.get("api/jtgDropDown/storehouseList" , {
        page,
		size
    }, {
        noAuth: true
    })
}

export function getDropDownTreeList(url) {
    return uni.request({
        url: VUE_APP_API_URL + "/appDropDown/" + url,
        method: 'GET'
    })
}

export function getCheckOrder(page, size) {
    return request.get("appStoreWareCheck", {
        page,
        size
    }, {
        noAuth: true
    })
}
export function getappProductRectify(page, size) {
    return request.get("api/appProductRectify", {
        page,
        size
    }, {
        noAuth: true
    })
}
export function getCheckOrderDetail(id) {
    return request.get("appStoreWareCheck", {
        id
    }, {
        noAuth: true
    })
}

//采购入库
export function getWareOrder(page, size) {
    return request.get("appStoreBuyWareorder", {
        page,
        size
    }, {
        noAuth: true
    })
}

//多条件查询采购入库
export function getWareOrderBySearch(data) {
    /**
	let search_data = {
        page,
        size
    }
	
	console.log(deptId,customerId)
    if (orderCode) search_data['orderCode'] = orderCode
    if (orderStatus) search_data['orderStatus'] = orderStatus
    if (supplierId) search_data['supplierId'] = supplierId
    if (warehouseId) search_data['warehouseId'] = warehouseId
    if (keyword) search_data['keyword'] = keyword
    if (customerAreaId) search_data['customerAreaId'] = customerAreaId
    if (customerId) search_data['customerId'] = customerId
    if (customerTypeId) search_data['customerTypeId'] = customerTypeId
    if (deptId) search_data['deptId'] = deptId
	//contractNo
    if (contractNo) search_data['contractNo'] = contractNo**/
    return request.get("api/appBuyEnterOrder", data, {
        noAuth: true
    })
}

//采购入库详情
export function getWareOrderDetail(id) {
    return request.get("appStoreBuyWareorder", {
        id
    }, {
        noAuth: true
    })
}

//采购入库提交
export function submitWareOrder(ids, type) {
    return request.post("api/appBuyEnterOrder/submit", {
        ids,
        type
    }, {
        noAuth: true
    })
}
//采购入库列表提交
export function submitWareOrderlist(ids, type) {
    return request.post("api/appBuyEnterOrder/passOrReject", {
        ids,
        type
    }, {
        noAuth: true
    })
}

//新增采购入库
export function addWareOrder(data) {
    return request.post("appStoreBuyWareorder/addOrSave", data, {
        noAuth: true
    })
}

//新增采购入库
export function calProductInfo(data) {
    return request.post("api/basProduct/calProductInfo", data, {
        noAuth: true
    })
}
//新增采购入库
export function calProductInfos(data) {
    return request.post("api/basProduct/calProductInfo", data, {
        noAuth: true
    })
}
//采购入库明细提交
export function submitWareOrderDetail(data) {
    return request.post("appStoreBuyWareorder/submit", data, {
        noAuth: true
    })
}

//采购入库 详情 保存
export function submitaddOrSave(data) {
    return request.post("api/appBuyEnterOrder/addOrSave", data, {
        noAuth: true
    })
}
//采购入库 详情 保存
export function submitSplitaddOrSave(data) {
    return request.post("api/appSplitOrder/addOrSave", data, {
        noAuth: true
    })
}

//采购入库 详情 保存

export function exportLogisticsManageProduct(data) {
    return request.get("api/appLogisticsManageReport/exportLogisticsManageProduct", data, 
	{
        noAuth: true
    })
}
export function appLogisticsManage(data) {
    return request.get("api/appLogisticsManage", data, {
        noAuth: true
    })
}
export function appProductCheck(data) {
    return request.get("api/appProductCheck", data, {
        noAuth: true
    })
}
export function logisticsManageReport(data) {
    return request.get("api/appLogisticsManageReport", data, {
        noAuth: true
    })
}
export function logisticsManagereceive(data) {
    return request.post("api/appLogisticsManageReport/receive", data, {
        noAuth: true
    })
}

export function customerLists(data) {
    return request.get("api/jtgDropDown/customerList", data, {
        noAuth: true
    })
}
export function buildOrderList(data) {
    return request.get("api/jtgDropDown/buildOrderList", data, {
        noAuth: true
    })
}
export function LogisticsremoveAll(data) {
    return request.post("api/appLogisticsManage/removeAll", data, {
        noAuth: true
    })
}
export function Logisticssubmit(data) {
    return request.post("api/appLogisticsManage/submit", data, {
        noAuth: true
    })
}
export function logisticsManageProduct(data) {
    return request.get("api/logisticsManageProduct", data, {
        noAuth: true
    })
}
export function LogisticsaddOrSave(data) {
    return request.post("api/appLogisticsManage/addOrSave", data, {
        noAuth: true
    })
}
export function LogisticspassOrReject(data) {
    return request.post("api/appLogisticsManage/passOrReject", data, {
        noAuth: true
    })
}
export function applogisticsreceive(data) {
    return request.post('api/appLogisticsManage/receive', data, {
        noAuth: true
    });
}
export function appProductAccept(data) {
    return request.get('api/appProductAccept', data, {
        noAuth: true
    });
}
export function appProductacceptaddOrSave(data) {
    return request.post('api/appProductAccept/addOrSave', data, {
        noAuth: true
    });
}
export function appProductAcceptsubmit(data) {
    return request.post('api/appProductAccept/submit', data, {
        noAuth: true
    });
}
export function appProductAcceptpassOrReject(data) {
    return request.post('api/appProductAccept/passOrReject', data, {
        noAuth: true
    });
}
export function appProductAcceptremoveAll(data) {
    return request.post('api/appProductAccept/removeAll', data, {
        noAuth: true
    });
}
export function procedureList(data) {
    return request.get('api/jtgDropDown/procedureList', data, {
        noAuth: true
    });
}
export function appProductpassOrReject(data) {
    return request.post('api/appProductCheck/passOrReject', data, {
        noAuth: true
    });
}
export function appProductremoveAll(data) {
    return request.post('api/appProductCheck/removeAll', data, {
        noAuth: true
    });
}
export function appProductCheckaccept(data) {
    return request.post('api/appProductCheck/accept', data, {
        noAuth: true
    });
}
export function appProductCheckrectify(data) {
    return request.post('api/appProductCheck/rectify', data, {
        noAuth: true
    });
}
export function appProductCheckaddOrSave(data) {
    return request.post('api/appProductCheck/addOrSave', data, {
        noAuth: true
    });
}
export function appProductChecksubmit(data) {
    return request.post('api/appProductCheck/submit', data, {
        noAuth: true
    });
}
export function appProductCheckpassOrReject(data) {
    return request.post('api/appProductCheck/passOrReject', data, {
        noAuth: true
    });
}
//采购入库 详情 提交
export function submitorder(data) {
    return request.post("api/appBuyEnterOrder/submit", data, {
        noAuth: true
    })
}
//采购入库 详情 提交
export function submitSplitorders(data) {
    return request.post("api/appSplitOrder/submit", data, {
        noAuth: true
    })
}

//删除采购入库明细
export function removeWareorder(data) {
    return request.post("api/appBuyEnterOrder/removeAll", 
        data, {
        noAuth: true
    })
}
//删除采购入库明细
export function Wareorderremove(data) {
    return request.post("api/appBuyEnterOrder/remove", 
        data, {
        noAuth: true
    })
}
export function updatePass(data) {
    return request.post("api/users/updatePass", 
        data, {
        noAuth: true
    })
}

//删除采购入库明细
/**
 * @param {Object} page
 * @param {Object} sizepage: pageNo,
					limit: pageSize,
					code: this.text,
					outWarehouseId: this.house_id.id,
					inWarehouseId: this.house_ids.id,
					splitType: this.lists_id.value,
					orderStatus
 */
export function appSplitOrders(page,size,code,outWarehouseId,inWarehouseId,splitType,orderStatus,id,sort) {
	let search_data = {
	    page,
	    size
	}
	if (code) search_data['code'] = code
	if (outWarehouseId) search_data['outWarehouseId'] = outWarehouseId
	if (inWarehouseId) search_data['inWarehouseId'] = inWarehouseId
	if (splitType) search_data['splitType'] = splitType
	if (orderStatus) search_data['orderStatus'] = orderStatus
	if (id) search_data['id'] = id
	if (sort) search_data['sort'] = sort
    return request.get("api/appSplitOrder", 
        search_data, {
        noAuth: true
    })
}

export function appSplitOrderdel(data) {
    return request.post("api/appSplitOrder/removeAll", 
        data, {
        noAuth: true
    })
}
export function appSplitOrderremove(data) {
    return request.post("api/appSplitOrder/remove", 
        data, {
        noAuth: true
    })
}
export function appSplitOrdersub(data) {
    return request.post("api/appSplitOrder/passOrReject", 
        data, {
        noAuth: true
    })
}
//获取商品详情
export function getGoodsInfo( id) {
    let params = {
        page: 0,
        size: 999,
    }
    if (id && id != '' && id != undefined)
        params['id'] = id
    return request.get("api/jtgDropDown/productList", params, {
        noAuth: true
    })
}
//获取商品详情
export function getGoodsInfos(data) {

    return request.get("api/jtgDropDown/productList", data, {
        noAuth: true
    })
}

//盘点单新增or修改
export function addOrSaveCheckOrder(data) {
    return request.post("appStoreWareCheck/addOrSave", data, {
        noAuth: true
    })
}

//删除盘点单明细
export function removeCheckorder(id) {
    return request.post("appStoreWareCheck/remove", {
        id: id
    }, {
        noAuth: true
    })
}

//查询库存记录
export function getStoreStockExist(page, size, productKeyword, cateId, supplierId, warehouseId) {
    let search_data = {
        page,
        size
    }
    if (productKeyword) search_data['keyword'] = productKeyword
    if (cateId) search_data['cateId'] = cateId
    if (supplierId) search_data['supplierId'] = supplierId
    if (warehouseId) search_data['warehouseId'] = warehouseId
    return request.get("api/appStockExist", search_data, {
        noAuth: true
    })
}

//查询库存记录
export function getStoreStockExistdetail(id) {
    let search_data={}
    if (id) search_data['existId'] = id
    return request.get("api/appStockExist/log", {
        existId:id,

    }, {
        noAuth: true
    })
}

//获取字典
export function getDictDetail(dictName) {
    return request.get("appDictDetail", {
        dictName,
        page: 0,
        size: 9999,
    }, {
        noAuth: true
    })
}

//获取字典
export function getDictlists(dictName) {
    return request.get("api/dictDetail", {
        dictName:dictName,
        page: 0,
        size: 9999,
    }, {
        noAuth: true
    })
}

//获取部门(树)
export function deptlist() {
    return request.get("api/jtgDropDown/deptTree", {}, {noAuth: true})
}
//获取部门(列表)
export function deptlists() {
    return request.get("api/jtgDropDown/childDeptList", {}, {noAuth: true})
}
//获取商品分类
export function getCateTree() {
    return request.get("api/jtgDropDown/productTypeTree", {
        
    }, {
        noAuth: true
    })
}

export function getsupplierList(data) {
    return request.get('api/jtgDropDown/supplierList', data, {
        noAuth: true
    });
}

/**
 export function getCheckOrder(page, size) {
	return request.get("appStoreBuyWareorder", {page, size}, { noAuth: true })
}**/

export function getwarehouseList(data) {
    return request.get('appDropDown/warehouseList', data, {
        noAuth: true
    });
}

export function enterremove(data) {
    return request.post('appStoreOtherEnter/remove', data, {
        noAuth: true
    });
}

export function appStoreOtherEnteraddOrSave(data) {
    return request.post('appStoreOtherEnter/addOrSave', data, {
        noAuth: true
    });
}

export function appStoreOtherEntersubmit(data) {
    return request.post('appStoreOtherEnter/submit', data, {
        noAuth: true
    });
}

export function submits(data) {
    return request.post('appStoreOtherOut/submit', data, {
        noAuth: true
    });
}

export function passOrReject(data) {
    return request.post('appStoreOtherEnter/passOrReject', data, {
        noAuth: true
    });
}

export function appStoreOtherEnter(data) {
    return request.get('appStoreOtherEnter', data, {
        noAuth: true
    });
}

export function outremove(data) {
    return request.post('appStoreOtherOut/remove', data, {
        noAuth: true
    });
}

export function addOrSaves(data) {
    return request.post('appStoreOtherOut/addOrSave', data, {
        noAuth: true
    });
}

export function passOrRejects(data) {
    return request.post('appStoreOtherOut/passOrReject', data, {
        noAuth: true
    });
}

export function appStoreOtherOut(data) {
    return request.get('appStoreOtherOut', data, {
        noAuth: true
    });
}

export function toGoodsDetail(barCode, id) {
    uni.navigateTo({
        url: "/pages/goodsDetail/index?barCode=" + barCode + "&id=" + id
    })
}

//barCode:barCode,cateId:cateId,deptId:deptId,id:id,keyword:keyword,
// limit:limit,orderCode:orderCode,page:page,priceOrder:priceOrder,productId:productId,salesOrder:salesOrder,
// sid:sid,size:size,sort:sort,status,status,supplierId:supplierId,supplierTypeId:supplierTypeId,
// type:type,userId:userId,warehouseId:warehouseId

export function warehouseList(data) {
    return request.get('api/jtgDropDown/warehouseList', data, {
        noAuth: true
    });
}
export function warehouseLists(data) {
    return request.get('api/jtgDropDown/warehouseList', data, {
        noAuth: true
    });
}

//cateId:cateId,deptId:deptId,id:id,keyword:keyword,limit,orderCode:orderCode,
//  page:page,productId:productId,size:size,sort:sort,status:status,supplierId:supplierId,supplierTypeId:supplierTypeId,
//  userId:userId,warehouseId:warehouseId

export function deptTree(data) {
    return request.get('appDropDown/deptTree', data, {
        noAuth: true
    });
}
export function deptTrees(data) {
    return request.get('api/jtgDropDown/deptTree', data, {
        noAuth: true
    });
}

export function userList(data) {
    return request.get('appDropDown/userList', data, {
        noAuth: true
    });
}

export function userLists(data) {
    return request.get('api/jtgDropDown/userList', data, {
        noAuth: true
    });
}

// 多条件查询物料领用
export function getAppProductCollect(data) {
    return request.get("api/appProductCollect", data, {
        noAuth: true
    })
}

// 物料领用提交
export function submitProductCollectlist(ids, type) {
    return request.post("api/appProductCollect/passOrReject", {
        ids,
        type
    }, {
        noAuth: true
    })
}
//删除采购入库明细
export function removeProductCollect(data) {
    return request.post("api/appProductCollect/removeAll", 
        data, {
        noAuth: true
    })
}
//删除采购入库明细
export function ProductCollectRemove(data) {
    return request.post("api/appProductCollect/remove", 
        data, {
        noAuth: true
    })
}
//物料领用提交
export function submitProductCollect(ids, type) {
    return request.post("api/appProductCollect/submit", {
        ids,
        type
    }, {
        noAuth: true
    })
}
//物料领用 详情 保存
export function submitProductCollectAddOrSave(data) {
    return request.post("api/appProductCollect/addOrSave", data, {
        noAuth: true
    })
}
//采购入库 详情 提交
export function submitProductCollectoOrder(data) {
    return request.post("api/appProductCollect/submit", data, {
        noAuth: true
    })
}

// 生产任务

export function getappAppProductTask(data) {
    return request.get("api/appProductTask", data, {
        noAuth: true
    })
}
// 生产任务(通过扫描二维码)
export function getappAppProductTasks(data) {
    return request.get("api/jtgDropDown/productTaskList", data, {
        noAuth: true
    })
}
// 生成任务提交
export function submitProductTasklist(ids, type) {
    return request.post("api/appProductTask/passOrReject", {
        ids,
        type
    }, {
        noAuth: true
    })
}
//删除生成任务
export function removeProductTask(data) {
    return request.post("api/appProductTask/removeAll", 
        data, {
        noAuth: true
    })
}
//删除采购生产任务
export function AppProductTaskRemove(data) {
    return request.post("api/appProductTask/remove", 
        data, {
        noAuth: true
    })
}
//生产任务 详情 保存
export function submitProductTaskAddOrSave(data) {
    return request.post("api/appProductTask/addOrSave", data, {
        noAuth: true
    })
}
//生产任务 详情 提交
export function submitProductTaskOrder(data) {
    return request.post("api/appProductTask/submit", data, {
        noAuth: true
    })
}

// 工序

export function procedureLists(data) {
    return request.get('api/jtgDropDown/procedureList', data, {
        noAuth: true
    });
}


// 生产整改

export function getappAppProductRectify(data) {
    return request.get("api/appProductRectify", data, {
        noAuth: true
    })
}
// 生成任务提交
export function submitProductRectifylist(ids, type) {
    return request.post("api/appProductRectify/passOrReject", {
        ids,
        type
    }, {
        noAuth: true
    })
}
//删除生产整改
export function removeProductRectify(data) {
    return request.post("api/appProductRectify/removeAll", 
        data, {
        noAuth: true
    })
}
//删除采购生产整改
export function AppProductRectifyRemove(data) {
    return request.post("api/appProductRectify/remove", 
        data, {
        noAuth: true
    })
}
//生产整改 详情 保存
export function submitProductRectifyAddOrSave(data) {
    return request.post("api/appProductRectify/addOrSave", data, {
        noAuth: true
    })
}
//生产整改 详情 提交
export function submitProductRectifyOrder(data) {
    return request.post("api/appProductRectify/submit", data, {
        noAuth: true
    })
}
//传部门id后获取对应部门的人员信息
export function getUserListByDeptId(data) {
    return request.get("api/jtgDropDown/userList", data, {
        noAuth: true
    })
}
//获取生产整改列表(分页)
export function getproductRectifyList(data) {
    return request.get("api/jtgDropDown/productRectifyList", data, {
        noAuth: true
    })
}
//获取质检列表(分页)
export function getproductCheckList(data) {
    return request.get("api/jtgDropDown/productCheckList", data, {
        noAuth: true
    })
}
//--上传生产前/生产后照片
export function uploadImageForTask(data) {
    return request.post("api/appProductTask/uploadImage", data, {
        noAuth: true
    })
}
//--上传整改照片
export function uploadRectifyImg(data) {
    return request.post("api/appProductRectify/uploadImage", data, {
        noAuth: true
    })
}
//--新增或修改拆装单详情
export function saveDismounting(data) {
    return request.post("api/splitOrderDetail/addOrSave", data, {
        noAuth: true
    })
}
//获取BOM清单列表
export function getBomList(data) {
    return request.get("api/jtgDropDown/productBomList", data, {
        noAuth: true
    })
}

//查询APP下料任务
export function getAppBaitingTask(data) {
    return request.get("api/appBaitingTask", data, {
        noAuth: true
    })
}
//查询APP下料任务详情中保存(新增或修改APP下料任务)
export function getAppBaitingTaskAddOrSave(data) {
    return request.post("api/appBaitingTask/addOrSave", data, {
        noAuth: true
    })
}
//查询APP下料任务 列表中提交(审核或反审APP下料任务)
export function getAppBaitingTaskPassOrReject(data) {
    return request.post("api/appBaitingTask/passOrReject", data, {
        noAuth: true
    })
}

//查询APP下料任务 列表中删除APP下料任务放
export function getAppBaitingTaskRemoveAll(data) {
    return request.post("api/appBaitingTask/removeAll", data, {
        noAuth: true
    })
}
//查询APP下料任务 列表中删除APP下料任务
export function getAppBaitingTaskSubmit(data) {
    return request.post("api/appBaitingTask/submit", data, {
        noAuth: true
    })
}
//查询APP下料任务 上传下料前/下料后照片
export function getAppBaitingTaskUploadImage(data) {
    return request.post("api/appBaitingTask/uploadImage", data, {
        noAuth: true
    })
}








//查询APP下料质检
export function getAppBaitingCheck(data) {
    return request.get("api/appBaitingCheck", data, {
        noAuth: true
    })
}

// APP下料质检中生成让步接收单据
export function getAppBaitingCheckAccept(data) {
    return request.post("api/appBaitingCheck/accept", data, {
        noAuth: true
    })
}
//查询APP下料质检 列表中提交(审核或反审APP下料任务)
export function getAppBaitingCheckPassOrReject(data) {
    return request.post("api/appBaitingCheck/passOrReject", data, {
        noAuth: true
    })
}

//查询APP下料质检 列表删除
export function getAppBaitingCheckRemoveAll(data) {
    return request.post("api/appBaitingCheck/removeAll", data, {
        noAuth: true
    })
}
//查询APP下料质检 baocun
export function appAppBaitingCheckaddOrSave(data) {
    return request.post("api/appBaitingCheck/addOrSave", data, {
        noAuth: true
    })
}

//查询APP下料质检 tijiao
export function appAppBaitingCheckpassOrReject(data) {
    return request.post("api/appBaitingCheck/passOrReject", data, {
        noAuth: true
    })
}
//查询APP下料质检 tijiao
export function appAppBaitingCheckpassOrSubmit(data) {
    return request.post("api/appBaitingCheck/submit", data, {
        noAuth: true
    })
}
//查询APP下料质检 整改
export function appAppBaitingCheckpassOrRectify(data) {
    return request.post("api/appBaitingCheck/rectify", data, {
        noAuth: true
    })
}
//查询APP下料质检 让步
export function appAppBaitingCheckpassOrAccept(data) {
    return request.post("api/appBaitingCheck/accept", data, {
        noAuth: true
    })
}



//查询APP下料整改
export function getAppBaitingRectify(data) {
    return request.get("api/appBaitingRectify", data, {
        noAuth: true
    })
}

//查询APP下料整改详情中保存(新增或修改APP下料整改)
export function appAppBaitingRectifyAddOrSave(data) {
    return request.post("api/appBaitingRectify/addOrSave", data, {
        noAuth: true
    })
}


//查询APP下料整改列表中提交(审核或反审APP下料整改)
export function appAppBaitingRectifyPassOrReject(data) {
    return request.post("api/appBaitingRectify/passOrReject", data, {
        noAuth: true
    })
}

//查询APP下料整改列表中删除APP下料整改
export function appAppBaitingRectifyRemoveAll(data) {
    return request.post("api/appBaitingRectify/removeAll", data, {
        noAuth: true
    })
}

//查询APP下料详情中提交(保存并提交APP下料整改)
export function appAppBaitingRectifySubmit(data) {
    return request.post("api/appBaitingRectify/submit", data, {
        noAuth: true
    })
}

//查询APP下上传APP下料整改照片
export function appAppBaitingRectifyUploadImage(data) {
    return request.post("api/appBaitingRectify/uploadImage", data, {
        noAuth: true
    })
}


//查询APP下上传APP下料整改照片

export function getAppBaitingAccept(data) {
    return request.get("api/appBaitingAccept", data, {
        noAuth: true
    })
}

//详情中保存(新增或修改APP下料让步接收)

export function appAppBaitingAcceptAddOrSave(data) {
    return request.post("api/appBaitingAccept/addOrSave", data, {
        noAuth: true
    })
}

//详情中列表中提交(审核或反审APP下料让步接收)
export function appAppBaitingAcceptPassOrReject(data) {
    return request.post("api/appBaitingAccept/passOrReject", data, {
        noAuth: true
    })
}

//详情中列表中删除
export function appAppBaitingAcceptRemoveAll(data) {
    return request.get("api/appBaitingAccept/removeAll", data, {
        noAuth: true
    })
}

//详情中列表中TIJIAO 
export function appAppBaitingAcceptSubmit(data) {
    return request.post("api/appBaitingAccept/submit", data, {
        noAuth: true
    })
}


export function appProductThirdCheck(data) {
    return request.get("api/appProductThirdCheck", data, {
        noAuth: true
    })
}

export function appProductThirdCheckAccept(data) {
    return request.post("api/appProductThirdCheck/accept", data, {
        noAuth: true
    })
}

export function appProductThirdCheckAddOrSave(data) {
    return request.post("api/appProductThirdCheck/addOrSave", data, {
        noAuth: true
    })
}

export function appProductThirdCheckPassOrReject(data) {
    return request.post("api/appProductThirdCheck/passOrReject", data, {
        noAuth: true
    })
}

export function appProductThirdCheckRemoveAll(data) {
    return request.post("api/appProductThirdCheck/removeAll", data, {
        noAuth: true
    })
}

export function appProductThirdCheckSubmit(data) {
    return request.post("api/appProductThirdCheck/submit", data, {
        noAuth: true
    })
}